package com.seari.scheduling.plan;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.stereotype.Component;

import com.alibaba.fastjson.JSON;
import com.seari.Utils.DateUtils;
import com.seari.bean.PersonInfoBean;
import com.seari.bean.ReqPlanShiftBean;

@Component
public class PlanMonNigClass implements PlanScheduClass
{
	
	@Override
	public List<PersonInfoBean> planScheduling(ReqPlanShiftBean bean,List<PersonInfoBean> pesonInfo)
	{
		
		int days = 0;
		if (bean.getPlanShiftType().equals("week"))
		{
			//
		}
		days = DateUtils.getDaysOfMonth(bean.getReqShiftDate()); // 获取当月天数
		
		int next = 0;
		for (int i = 0; i < days; i++)
		{
			if(next < 0) {
				pesonInfo.get(0).getShiftInfo().add(i,"日");
				pesonInfo.get(1).getShiftInfo().add(i,"休");
			}else {
				pesonInfo.get(1).getShiftInfo().add(i,"日");
				pesonInfo.get(0).getShiftInfo().add(i,"休");
			}
			next = ~next;
		}
		
//		String jsonString = JSON.toJSONString(pesonInfo);
//		System.out.println(jsonString);
		return pesonInfo;
	}
	
	public static void main(String[] args)
	{
		PlanMonNigClass plan = new PlanMonNigClass(); 
		ReqPlanShiftBean bean = new ReqPlanShiftBean();
		bean.setReqShiftDate("19-01");
		
		List<PersonInfoBean> pesonInfo = new ArrayList<>();

		PersonInfoBean personInfo1 = new PersonInfoBean();
		personInfo1.setUid(9);
		personInfo1.setShiftInfo(new ArrayList<>());
		personInfo1.setUname("王五1");
		personInfo1.setPostInfo("设备值班员");
		personInfo1.setShift("monNig");
		pesonInfo.add(personInfo1);

		PersonInfoBean personInfo2 = new PersonInfoBean();
		personInfo2.setUid(10);
		personInfo2.setShiftInfo(new ArrayList<>());
		personInfo2.setUname("王五2");
		personInfo2.setPostInfo("设备值班员");
		personInfo2.setShift("monNig");
		pesonInfo.add(personInfo2);
		
		plan.planScheduling(bean, pesonInfo);
	}
}
